import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:intl/intl.dart';


class CalendarHeader extends StatelessWidget {
  /// 当前日期
  final DateTime focusedDay;

  /// 向左箭头点击事件
  final VoidCallback onLeftArrowTap;

  /// 向右箭头点击事件
  final VoidCallback onRightArrowTap;

  /// 定位到当前日期
  final VoidCallback onTodayButtonTap;

  /// 清除点击事件
  final VoidCallback onClearButtonTap;

  final bool clearButtonVisible;
  final bool todayButtonVisible;

  final TextStyle textStyle;

  final dynamic locale;

  const CalendarHeader({
    super.key,
    this.locale = 'zh',
    required this.focusedDay,
    required this.onLeftArrowTap,
    required this.onRightArrowTap,
    required this.onTodayButtonTap,
    required this.onClearButtonTap,
    this.clearButtonVisible = false,
    this.todayButtonVisible = false,
    this.textStyle = const TextStyle(fontSize: 20, color: Colors.black),
  });

  @override
  Widget build(BuildContext context) {
    final headerText = DateFormat.yMMMM(locale).format(focusedDay);

    return Padding(
      padding: EdgeInsets.symmetric(vertical: 28.w, horizontal: 90.w),
      child: Row(
        mainAxisAlignment: MainAxisAlignment.spaceBetween,
        children: [
          IconButton(icon: const Icon(Icons.chevron_left), onPressed: onLeftArrowTap),
          Row(
            mainAxisAlignment: MainAxisAlignment.spaceBetween,
            children: [
              Text(headerText, style: textStyle),
              // if (clearButtonVisible)
              //   IconButton(
              //     icon: const Icon(Icons.clear),
              //     visualDensity: VisualDensity.compact,
              //     onPressed: onClearButtonTap,
              //   ),
              // const Spacer(),
              // if (todayButtonVisible)
              //   IconButton(
              //     icon: const Icon(Icons.calendar_today),
              //     visualDensity: VisualDensity.compact,
              //     onPressed: onTodayButtonTap,
              //   ),
            ],
          ),
          IconButton(icon: const Icon(Icons.chevron_right), onPressed: onRightArrowTap),
        ],
      ),
    );
  }
}
